// ************************************************************************************************
// Objet type IFRAME
// VERSION:
// DATE:
// ************************************************************************************************
// PROPRIETES DE cr?ation :                                                          OBLIGATOIRE
// Name:               Nom de l'IFrame        (name + ID)                               OUI
// ************************************************************************************************

// *************************************
// CONSTRUCTEUR DE L'OBJET
// *************************************

// METHODES
objFrame.prototype.nbreInstance=0;

function objFrame(name,top,left,width,height,bAffiche){
// PROPRIETES
        this.name=name;
        this.id= name+"_"+(objFrame.prototype.nbreInstance++);        
        if(!bAffiche){
            this.top=0;this.left=0;this.width=0;this.height=0;
            this.visibility="hidden";
        }
        else{
            this.visibility="visible";
            this.top=top;this.left=left;this.width=width;this.height=height;
        }
        this.visibility="visible";        
        this.top=200;this.left=200;this.width=200;this.height=200;
}




// *******************************************
// GENERATION DE L'INSTANCE SUR LE DOM
// *******************************************
objFrame.prototype.create=function (parent) {        
    rialto.session.reccord(this,this.id);
    var oThis=this;      
    this.frame=document.createElement('iframe');
    this.frame.style.position="absolute";
    this.frame.style.visibility=this.visibility;
    this.frame.style.top=this.top;
    this.frame.style.left=this.left;
    this.frame.style.width=this.width;
    this.frame.style.border="0px solid black";
	this.frame.style.backgroundColor="white";
    this.frame.style.height=this.height;
    this.frame.id=this.id+"IFRAME";    
    this.frame.name=this.id+"IFRAME"; 
    this.frame.src="";    
    this.frame.oCiu=this;          
    
    
    
    if (parent) {
    	this.placeIn(parent);
    }
    else{
	    document.body.appendChild(this.frame);
    };
       
    
}

objFrame.prototype.masque = function() {
    this.frame.style.width = 0;
    this.frame.style.height = 0;
}

objFrame.prototype.placeIn=function(parent) {
    /********************AJOUT AU PARENT ****************************/     
    //appel d'une eventuelle m?thode ADD
    if (parent.add){        
        parent.add(this.frame);  
    }
    else{
        parent.appendChild(this.frame);            
    }        
    //r?cup?ration du parent HTML
    this.parent=this.frame.parentNode;       
}


objFrame.prototype.remplit=function (inner) {
   fr=document.getElementById(this.id+"IFRAME");
   fr.contentWindow.document.write(inner);   
}

objFrame.prototype.reload=function (inner) {
   fr=document.getElementById(this.id+"IFRAME");
   fr.contentWindow.document.location.reload();
}

objFrame.prototype.load=function (url) {    
    if (url!=null){
        this.url = String(url);             
        //chargement avec l'url                
        this.IFrameDoc = this.frame.contentWindow.document;        
        this.IFrameDoc.location.replace(this.url);    
    }
}


objFrame.prototype.masque=function () {    
    //this.frame.style.display='none';
    this.frame.style.visibility='hidden'
}


objFrame.prototype.affiche=function () {    
//    this.frame.style.display='block';
    this.frame.style.visibility='visible'
}



objFrame.prototype.trace=function () {    
    //window.DATA.innerHTML=this.frame.innerHTML;
}


objFrame.prototype.getObjHtml = function () {
    return this.frame;
}

objFrame.prototype.delFrame=function (parent) {
    //pour enlever l'Iframe
    this.parent.removeChild(this.frame)
}
